import request from '@/utils/request'
import type { trademark, trademarkResponseData } from './model/trademark'

//枚举api
enum API{
    TRADEMARKLIST = '/admin/product/baseTrademark/',
    ADDTRADEMARK = '/admin/product/baseTrademark/save',
    UPDATETRADEMARK = '/admin/product/baseTrademark/update',
    DELETE = '/admin/product/baseTrademark/remove/'
}

// 获取品牌管理的接口
export const reqTrademarkList = (page:number,limit:number) =>request.get<any,trademarkResponseData>(API.TRADEMARKLIST + `${page}/${limit}`)

// 添加或修改品牌数据的接口
export const reqAddOrUpdateTrademark = (data:trademark) =>{
    //如果有id就是更新,没有就是添加
    if(data.id){
        request.put<any,any>(API.UPDATETRADEMARK,data)
    }else{
        request.post<any,any>(API.ADDTRADEMARK,data)
    }
}

// 删除品牌的接口
export const reqDelateTrademark = (data:trademark) =>request.delete<any,any>(API.DELETE + `${data.id}`)
